#pragma once
#include"epoll_server.hpp"
#include"socket.hpp"
using namespace std;

int main(int argc,char* argv[])
{
  if(argc!=2)
  {
    cout<<"可执行文件 端口号"<<endl;
    exit(0);
  }

  int port=atoi(argv[1]);
  Socket* sptr=Socket::GetSocketObj(port);
  sptr->Init();
  int lisent_sock=sptr->GetLisent();

  cout<<lisent_sock<<endl;

  SetNonBlock(lisent_sock);
  int epollfd=epoll_create(256);
  Reactor* reactor=Reactor::GetReactorObj(epollfd,lisent_sock);
  reactor->Addfd(lisent_sock,EPOLLIN|EPOLLET);
  while(true)
  {
    reactor->Distribute();
  }
  return 0;
}

